<?php 
session_start();
//############### detection langague###########################
$lang = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
  	if(isset($_GET["lang"]))
  	{
  		$_SESSION['language']=$_GET["lang"];
  		$sitelang=$_GET["lang"];
  		switch ($_GET["lang"])
			{
   			 case 'en':
       
       			 $sitelang='en';
        		$changelang="fr";
        		break;
   			 case 'fr':
       			 $sitelang='fr';
       			 $changelang="en";
       			 break;
   
   			 default:
       			 $sitelang='en';
        			 $changelang="fr";
       			 break;
	}//switch
  		
  	}else{
 	if(isset($_SESSION['language']))
 	{
 		  switch ($_SESSION['language'])
			{
   			 case 'en':
       
       			 $sitelang='en';
        		$changelang="fr";
        		break;
   			 case 'fr':
       			 $sitelang='fr';
       			 $changelang="en";
       			 break;
   
   			 default:
       			 $sitelang='en';
        			 $changelang="fr";
       			 break;
			}//switch
 		
 		
 		}else{

	switch ($lang)
	{
    case 'en':
       
        $sitelang='en';
        $changelang="fr";
        break;
    case 'fr':
        $sitelang='fr';
        $changelang="en";
        break;
   
    default:
        $sitelang='en';
         $changelang="fr";
        break;
	}//switch
 	}//if isset session
  	}//if url lang
  	
 //####################################################################### 	
class get_c_str {
var $str;
var $start_str;
var $end_str;
var $start_pos;
var $end_pos;
var $c_str_l;
var $contents;
function get_str($str,$start_str,$end_str){
   $this->str = $str;
   $this->start_str = $start_str;
   $this->end_str = $end_str;
   $this->start_pos = strpos($this->str,$this->start_str)+strlen($this->start_str);
     $this->end_pos = strpos($this->str,$this->end_str);
   $this->c_str_l = $this->end_pos - $this->start_pos;
   $this->contents = substr($this->str,$this->start_pos,$this->c_str_l);
   return $this->contents;
}
}

//fr url
if($sitelang=="fr"){
$url_carte_fr = "http://restaurantholder.com/menu-regulier-a-la-carte/";
$contents_catre_fr = file_get_contents($url_carte_fr);
$url_desserts_fr = "http://restaurantholder.com/desserts-fromages-autres/";
$contents_desserts_fr = file_get_contents($url_desserts_fr);
$linkback='<br/><a style="position:relative; left:20px;" href="index.php?lang=fr">Retour Accueil </a>';
$deserttits="<h2>DESSERTS</h2>";
}

if($sitelang=="en"){
$url_carte_fr = "http://restaurantholder.com/en/menu-regulier-a-la-carte/";
$contents_catre_fr = file_get_contents($url_carte_fr);
$url_desserts_fr = "http://restaurantholder.com/en/desserts-fromages-autres/";
$contents_desserts_fr = file_get_contents($url_desserts_fr);
$linkback='<br/><a style="position:relative; left:20px;" href="index.php?lang=en">Back Home </a>';
$deserttits="<h2>DESSERTS</h2>";
}
//echo $contents;


?>
<!DOCTYPE html> 
<html> 
<head> 
	<title>Holder-menus-fr</title> 
	 <meta http-equiv="content-type" content="text/html;charset=UTF-8" /> 
	<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.css" />
  <link rel="stylesheet" href="custom.css" />
	   <!--[if lt IE 9]>
<script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->

    <script type="text/javascript" src="http://code.jquery.com/jquery-1.4.3.min.js"></script>
   
    <script type="text/javascript" src="http://code.jquery.com/mobile/1.0a3/jquery.mobile-1.0a3.min.js"></script>

<script>
$(function(){
	$(".menus-center table").attr("width","500");
	$(".menus-center table td h2").css("font-size","110%");
	$("#cttable").append('<?php echo $linkback;?>');
	//$("#tablec").text('<?php echo $deserttits;?>')
	
	
})

</script>
</head> 
	<body>

	<div data-role="page" id="main" style="max-width:535px; z-index:0;">
    
    
<div id="wrap">





	<div id="wrap-header">
		<div id="header" >
		<a href="index.php?lang=<?php echo $sitelang; ?>"><img id="logo" src="images/menus-header-<?php echo $sitelang; ?>.jpg" width="100%" style="z-index:2; margin-bottom:-6%"> </a>
          
		</div><!-- /header -->
    </div><!--/wrap-header-->



<div id="wrap-center">
		<div id="center" class="menus-center">	
	<div id="cttable">
<?php 
$get_c_str = new get_c_str;
$intial_fr=html_entity_decode($get_c_str -> get_str($contents_catre_fr,'page_content">',"</table>"));
	 
	  echo  $intial_fr."<br/><div id='tablec'></div>";
	  		 
?>

<?php 
//$get_c_str = new get_c_str;
$intial_d_fr=html_entity_decode($get_c_str -> get_str($contents_desserts_fr,'page_content">',"</table>"));
	 
	  echo  $intial_d_fr."<div id='tabled'></div>";
	  
	  		 
?>
</div>

	
           
   		</div><!-- /center   menus-center -->
   	
</div><!--/wrap-center-->




	<!--<div id="wrap-foot">
		<div id="foot" >
        

		</div><!-- /footer -->
	<!--</div><!--/wrap-foot-->

  


</div><!--/wrap-->
</div><!-- /page -->

</body>